package com.ymttest.database.sqlwapper.sqdistributor;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.sqdistributor.DistributorConsumerRelationLog;

public class DistributorConsumerRelationLogWrapper {
	
	SqlManager manager;

	public DistributorConsumerRelationLogWrapper() {
		manager = new SqlManager("sqdistributor");
	}

	@SuppressWarnings("unchecked")
	public DistributorConsumerRelationLog selectByPrimaryKey(Long id) {

		DistributorConsumerRelationLog distributorConsumerRelationLog = null;
		List<DistributorConsumerRelationLog> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.sqdistributor.DistributorConsumerRelationLogMapper.selectByPrimaryKey",
						id);
		manager.commit();

		if (result.size() > 0) {
			distributorConsumerRelationLog = result.get(0);
		}

		return distributorConsumerRelationLog;
	}
	
	@SuppressWarnings("unchecked")
	public DistributorConsumerRelationLog selectByMerchatIdAndUserId(Long merchantId, Long userId) {

		DistributorConsumerRelationLog distributorConsumerRelationLog = null;
		
		HashMap<String, Long> map = new HashMap<>();
		
		map.put("merchantId", merchantId);
		map.put("userId", userId);
		
		List<DistributorConsumerRelationLog> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.sqdistributor.DistributorConsumerRelationLogMapper.selectByMerchatIdAndUserId",
						map);
		manager.commit();

		if (result.size() > 0) {
			distributorConsumerRelationLog = result.get(0);
		}

		return distributorConsumerRelationLog;
	}
	
	public static void main(String[] args) {
		
		DistributorConsumerRelationLogWrapper test = new DistributorConsumerRelationLogWrapper();
		
//		SellerLevelHistory sellerLevelHistory = new SellerLevelHistory();
//		
//		sellerLevelHistory.setDDate(YMTDateUtil.getDate());
//		sellerLevelHistory.setSellerID(24635724);
//		sellerLevelHistory.setUpdateTime(YMTDateUtil.getDate());
//		sellerLevelHistory.setUnconfirm_amount(BigDecimal.TEN);
//		
		System.out.println(test.selectByPrimaryKey(4L));
	}
}
